﻿using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ReaWTM.LayuiHelper
{


}
namespace ReaWTM.LayuiHelper
{

	[HtmlTargetElement("wt:tag", TagStructure = TagStructure.NormalOrSelfClosing)]
	public class TagTagHelper : BaseTag
	{
		public bool IsBlock { get; set; }
		public FloatEnum Float { get; set; } = FloatEnum.None;
		public TagStyle TagStyle { get; set; }
		string GetTagName()
		{
			if (IsBlock)
			{
				return "div";
			}
			else
			{
				return "span";
			}
		}
		public override void Process(TagHelperContext context, TagHelperOutput output)
		{
			output.TagName = GetTagName();
			output.Attributes.Add("class", $"rea-wtm-tag {base.GetBgColorClass()} {base.GetFontSizeClass()} {base.GetFontColorClass()}");

			if (Float != FloatEnum.None)
			{
				output.PreElement.AppendHtml("<div>");
				output.Attributes.Add("style", $"position:absolute;{Float.ToString().ToLower()}:10px;");
				output.PostElement.AppendHtml("</div>");
			}
			base.Process(context, output);
		}
	}
}
